package com.example.footballsystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.footballsystem.entity.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BookMapper extends BaseMapper<Book> {
    @Select("select * from book")
    public List<Book> getAllBook();
    @Select("select * from book where bookID=#{bookID}")
    public List<Book> getBookByID(int bookID);
    @Select("select * from book where bookUser=#{bookUser}")
    public List<Book> getBookByUserAccount(String bookUser);
    @Select("select * from book where field=#{field}")
    public  List<Book> getBookByField(int field);
    @Insert("insert into book (bookID, bookUser, field, time, createdate) VALUES (#{bookID}," +
            "#{bookUser},#" +
            "{field}," +
            "#{time}," +
            "#{createDate})")
    public Boolean addBook(Book book);
    @Delete("delete from book where bookID=#{bookID}")
    public Boolean deleteBook(int bookID);
}
